home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7989 < prev    next >
Mailbox/MIME Entity  |  1996-08-05  |  2.7 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: Mailbox/MIME Entity (archive/mbox).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert Mailbox/MIME Entity (archive/mbox) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file news text default
99% file C++ source text default
98% file C++ source, ASCII text default
100% checkBytes Printable ASCII default
100% dexmagic PrintFox/Pagefox WEAK default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/950 MIME Email (1.0) default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime message/news default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 50 61 74 68 3a 20 74 6d | 70 6e 65 77 73 2e 63 72 |Path: tm|pnews.cr|
|00000010| 64 2e 67 65 2e 63 6f 6d | 21 72 65 62 65 63 63 61 |d.ge.com|!rebecca|
|00000020| 21 72 70 69 21 75 73 65 | 6e 65 74 0a 46 72 6f 6d |!rpi!use|net.From|
|00000030| 3a 20 42 6f 77 64 65 6e | 20 57 69 73 65 20 3c 77 |: Bowden| Wise <w|
|00000040| 69 73 65 62 40 63 73 2e | 72 70 69 2e 65 64 75 3e |iseb@cs.|rpi.edu>|
|00000050| 0a 4e 65 77 73 67 72 6f | 75 70 73 3a 20 63 6f 6d |.Newsgro|ups: com|
|00000060| 70 2e 6c 61 6e 67 2e 63 | 2b 2b 0a 53 75 62 6a 65 |p.lang.c|++.Subje|
|00000070| 63 74 3a 20 52 65 3a 20 | 56 69 72 74 75 61 6c 20 |ct: Re: |Virtual |
|00000080| 43 6f 6e 73 74 72 75 63 | 74 6f 72 73 20 28 68 6f |Construc|tors (ho|
|00000090| 77 20 74 6f 20 69 6d 70 | 6c 65 6d 65 6e 74 29 3f |w to imp|lement)?|
|000000a0| 0a 44 61 74 65 3a 20 46 | 72 69 2c 20 31 36 20 46 |.Date: F|ri, 16 F|
|000000b0| 65 62 20 31 39 39 36 20 | 31 34 3a 31 33 3a 31 31 |eb 1996 |14:13:11|
|000000c0| 20 2d 30 38 30 30 0a 4f | 72 67 61 6e 69 7a 61 74 | -0800.O|rganizat|
|000000d0| 69 6f 6e 3a 20 52 65 6e | 73 73 65 6c 61 65 72 20 |ion: Ren|sselaer |
|000000e0| 50 6f 6c 79 74 65 63 68 | 6e 69 63 20 49 6e 73 74 |Polytech|nic Inst|
|000000f0| 69 74 75 74 65 2c 20 43 | 6f 6d 70 75 74 65 72 20 |itute, C|omputer |
|00000100| 53 63 69 65 6e 63 65 0a | 4d 65 73 73 61 67 65 2d |Science.|Message-|
|00000110| 49 44 3a 20 3c 33 31 32 | 35 30 31 37 37 2e 34 43 |ID: <312|50177.4C|
|00000120| 41 44 40 63 73 2e 72 70 | 69 2e 65 64 75 3e 0a 52 |AD@cs.rp|i.edu>.R|
|00000130| 65 66 65 72 65 6e 63 65 | 73 3a 20 3c 34 67 30 6c |eference|s: <4g0l|
|00000140| 6c 65 24 6e 6d 71 40 6a | 6f 62 65 2e 73 68 65 6c |le$nmq@j|obe.shel|
|00000150| 6c 2e 70 6f 72 74 61 6c | 2e 63 6f 6d 3e 0a 4e 4e |l.portal|.com>.NN|
|00000160| 54 50 2d 50 6f 73 74 69 | 6e 67 2d 48 6f 73 74 3a |TP-Posti|ng-Host:|
|00000170| 20 68 6f 6f 76 65 72 2e | 63 73 2e 72 70 69 2e 65 | hoover.|cs.rpi.e|
|00000180| 64 75 0a 4d 69 6d 65 2d | 56 65 72 73 69 6f 6e 3a |du.Mime-|Version:|
|00000190| 20 31 2e 30 0a 43 6f 6e | 74 65 6e 74 2d 54 79 70 | 1.0.Con|tent-Typ|
|000001a0| 65 3a 20 74 65 78 74 2f | 70 6c 61 69 6e 3b 20 63 |e: text/|plain; c|
|000001b0| 68 61 72 73 65 74 3d 75 | 73 2d 61 73 63 69 69 0a |harset=u|s-ascii.|
|000001c0| 43 6f 6e 74 65 6e 74 2d | 54 72 61 6e 73 66 65 72 |Content-|Transfer|
|000001d0| 2d 45 6e 63 6f 64 69 6e | 67 3a 20 37 62 69 74 0a |-Encodin|g: 7bit.|
|000001e0| 58 2d 4d 61 69 6c 65 72 | 3a 20 4d 6f 7a 69 6c 6c |X-Mailer|: Mozill|
|000001f0| 61 20 32 2e 30 20 28 57 | 69 6e 31 36 3b 20 49 29 |a 2.0 (W|in16; I)|
|00000200| 0a 54 6f 3a 20 43 6c 61 | 72 65 20 43 68 75 20 3c |.To: Cla|re Chu <|
|00000210| 63 6c 61 72 65 40 73 68 | 65 6c 6c 2e 70 6f 72 74 |clare@sh|ell.port|
|00000220| 61 6c 2e 63 6f 6d 3e 0a | 0a 43 6c 61 72 65 20 43 |al.com>.|.Clare C|
|00000230| 68 75 20 77 72 6f 74 65 | 3a 0a 3e 20 0a 3e 20 49 |hu wrote|:.> .> I|
|00000240| 20 68 61 76 65 20 61 6e | 20 61 62 73 74 72 61 63 | have an| abstrac|
|00000250| 74 20 62 61 73 65 20 63 | 6c 61 73 73 20 50 61 63 |t base c|lass Pac|
|00000260| 6b 65 74 2e 20 20 49 6e | 68 65 72 69 74 65 64 20 |ket. In|herited |
|00000270| 66 72 6f 6d 20 50 61 63 | 6b 65 74 0a 3e 20 61 72 |from Pac|ket.> ar|
|00000280| 65 20 73 70 65 63 69 66 | 69 63 20 70 61 63 6b 65 |e specif|ic packe|
|00000290| 74 73 20 6c 69 6b 65 20 | 4c 6f 67 69 6e 50 61 63 |ts like |LoginPac|
|000002a0| 6b 65 74 2c 20 41 75 64 | 69 74 50 61 63 6b 65 74 |ket, Aud|itPacket|
|000002b0| 2c 20 65 74 63 2e 0a 0a | 3e 20 57 68 61 74 20 49 |, etc...|> What I|
|000002c0| 20 6e 65 65 64 20 69 73 | 20 74 6f 20 72 65 61 64 | need is| to read|
|000002d0| 20 61 20 73 6f 63 6b 65 | 74 20 28 73 74 72 65 61 | a socke|t (strea|
|000002e0| 6d 29 2c 20 61 6e 64 20 | 74 68 65 6e 20 63 6f 6e |m), and |then con|
|000002f0| 73 74 72 75 63 74 0a 3e | 20 74 68 65 20 70 61 63 |struct.>| the pac|
|00000300| 6b 65 74 20 6f 66 20 74 | 68 65 20 72 69 67 68 74 |ket of t|he right|
|00000310| 20 6b 69 6e 64 2c 20 64 | 65 70 65 6e 64 69 6e 67 | kind, d|epending|
|00000320| 20 6f 6e 20 77 68 61 74 | 20 69 74 20 69 73 2e 0a | on what| it is..|
|00000330| 0a 54 68 69 73 20 73 6f | 75 6e 64 73 20 6c 69 6b |.This so|unds lik|
|00000340| 65 20 79 6f 75 20 77 61 | 6e 74 20 74 6f 20 63 72 |e you wa|nt to cr|
|00000350| 65 61 74 65 20 61 20 53 | 6f 63 6b 65 74 20 63 6c |eate a S|ocket cl|
|00000360| 61 73 73 2c 20 74 68 61 | 74 20 63 61 6e 0a 75 73 |ass, tha|t can.us|
|00000370| 65 20 61 6e 79 20 6f 66 | 20 74 68 65 20 67 69 76 |e any of| the giv|
|00000380| 65 6e 20 63 6f 6e 63 72 | 65 74 65 20 50 61 63 6b |en concr|ete Pack|
|00000390| 65 74 20 74 79 70 65 73 | 3a 0a 0a 20 20 20 63 6c |et types|:.. cl|
|000003a0| 61 73 73 20 53 6f 63 6b | 65 74 0a 20 20 20 7b 0a |ass Sock|et. {.|
|000003b0| 20 20 20 70 75 62 6c 69 | 63 3a 0a 20 20 20 20 20 | publi|c:. |
|000003c0| 20 53 6f 63 6b 65 74 20 | 28 29 3b 0a 20 20 20 20 | Socket |();. |
|000003d0| 20 20 7e 53 6f 63 6b 65 | 74 20 28 29 3b 0a 0a 20 | ~Socke|t ();.. |
|000003e0| 20 20 20 20 20 62 6f 6f | 6c 20 52 65 61 64 53 74 | boo|l ReadSt|
|000003f0| 72 65 61 6d 20 28 29 3b | 0a 0a 20 20 20 70 72 69 |ream ();|.. pri|
|00000400| 76 61 74 65 3a 0a 20 20 | 20 20 20 20 50 61 63 6b |vate:. | Pack|
|00000410| 65 74 2a 20 5f 70 61 63 | 6b 65 74 3b 20 20 2f 2f |et* _pac|ket; //|
|00000420| 20 48 61 6e 64 6c 65 20 | 74 6f 20 74 68 65 20 70 | Handle |to the p|
|00000430| 61 63 6b 65 74 0a 20 20 | 20 7d 3b 0a 0a 59 6f 75 |acket. | };..You|
|00000440| 20 63 6f 75 6c 64 20 6d | 61 6b 65 20 52 65 61 64 | could m|ake Read|
|00000450| 53 74 72 65 61 6d 28 29 | 20 64 65 74 65 72 6d 69 |Stream()| determi|
|00000460| 6e 65 20 77 68 61 74 20 | 6b 69 6e 64 20 6f 66 20 |ne what |kind of |
|00000470| 70 61 63 6b 65 74 20 69 | 73 20 0a 6e 65 65 64 65 |packet i|s .neede|
|00000480| 64 20 66 72 6f 6d 20 74 | 68 65 20 73 74 72 65 61 |d from t|he strea|
|00000490| 6d 2c 20 61 6e 64 20 74 | 68 65 6e 20 6e 65 77 20 |m, and t|hen new |
|000004a0| 74 68 65 20 63 6f 72 72 | 65 63 74 20 6b 69 6e 64 |the corr|ect kind|
|000004b0| 20 6f 66 0a 70 61 63 6b | 65 74 2e 0a 0a 54 68 69 | of.pack|et...Thi|
|000004c0| 73 20 69 73 20 6b 6e 6f | 77 6e 20 61 73 20 74 68 |s is kno|wn as th|
|000004d0| 65 20 68 61 6e 64 6c 65 | 2f 62 6f 64 79 20 69 64 |e handle|/body id|
|000004e0| 69 6f 6d 3b 20 53 6f 63 | 6b 65 74 20 69 73 20 74 |iom; Soc|ket is t|
|000004f0| 68 65 20 68 61 6e 64 6c | 65 0a 77 68 65 72 65 20 |he handl|e.where |
|00000500| 50 61 63 6b 65 74 20 69 | 73 20 74 68 65 20 62 6f |Packet i|s the bo|
|00000510| 64 79 2e 20 20 49 74 20 | 69 73 20 61 6c 73 6f 20 |dy. It |is also |
|00000520| 63 61 6c 6c 65 64 20 74 | 68 65 20 22 42 72 69 64 |called t|he "Brid|
|00000530| 67 65 22 0a 70 61 74 74 | 65 72 6e 20 62 79 20 47 |ge".patt|ern by G|
|00000540| 61 6d 6d 61 2c 20 48 65 | 6c 6d 2c 20 4a 6f 68 6e |amma, He|lm, John|
|00000550| 73 6f 6e 2c 20 61 6e 64 | 20 56 6c 69 73 73 69 64 |son, and| Vlissid|
|00000560| 65 73 20 69 6e 20 44 65 | 73 69 67 6e 20 50 61 74 |es in De|sign Pat|
|00000570| 74 65 72 6e 73 3a 20 0a | 45 6c 65 6d 65 6e 74 73 |terns: .|Elements|
|00000580| 20 6f 66 20 52 65 75 73 | 61 62 6c 65 20 4f 62 6a | of Reus|able Obj|
|00000590| 65 63 74 2d 4f 72 69 65 | 6e 74 65 64 20 53 6f 66 |ect-Orie|nted Sof|
|000005a0| 74 77 61 72 65 2e 0a 0a | 49 74 20 69 73 20 61 6c |tware...|It is al|
|000005b0| 73 6f 20 70 6f 73 73 69 | 62 6c 65 20 74 6f 20 6d |so possi|ble to m|
|000005c0| 61 6b 65 20 74 68 65 20 | 63 6f 6e 73 74 72 75 63 |ake the |construc|
|000005d0| 74 6f 72 20 72 65 61 64 | 20 74 68 65 20 73 74 72 |tor read| the str|
|000005e0| 65 61 6d 0a 61 6e 64 20 | 63 72 65 61 74 65 20 74 |eam.and |create t|
|000005f0| 68 65 20 70 61 63 6b 65 | 74 2e 0a 0a 3e 20 49 20 |he packe|t...> I |
|00000600| 6e 65 65 64 20 73 6f 6d | 65 6f 6e 65 20 74 6f 20 |need som|eone to |
|00000610| 62 61 73 69 63 61 6c 6c | 79 20 6f 75 74 6c 69 6e |basicall|y outlin|
|00000620| 65 20 77 68 61 74 20 49 | 20 6e 65 65 64 20 74 6f |e what I| need to|
|00000630| 20 64 6f 20 74 6f 20 73 | 65 74 0a 3e 20 75 70 20 | do to s|et.> up |
|00000640| 73 75 63 68 20 61 20 66 | 75 6e 63 74 69 6f 6e 20 |such a f|unction |
|00000650| 74 68 61 74 20 72 65 61 | 64 73 20 66 72 6f 6d 20 |that rea|ds from |
|00000660| 61 20 73 74 72 65 61 6d | 2c 20 70 72 6f 64 75 63 |a stream|, produc|
|00000670| 65 73 20 74 68 65 20 61 | 70 70 72 6f 70 72 69 61 |es the a|ppropria|
|00000680| 74 65 0a 3e 20 6f 62 6a | 65 63 74 20 61 6e 64 20 |te.> obj|ect and |
|00000690| 72 65 74 75 72 6e 73 20 | 61 20 70 6f 69 6e 74 65 |returns |a pointe|
|000006a0| 72 20 74 6f 20 50 61 63 | 6b 65 74 20 70 6f 69 6e |r to Pac|ket poin|
|000006b0| 74 69 6e 67 20 74 6f 20 | 74 68 65 20 6f 62 6a 65 |ting to |the obje|
|000006c0| 63 74 0a 3e 20 77 68 69 | 63 68 20 69 73 20 6f 66 |ct.> whi|ch is of|
|000006d0| 20 74 68 65 20 61 70 70 | 72 6f 70 72 69 61 74 65 | the app|ropriate|
|000006e0| 20 64 65 72 69 76 65 64 | 20 63 6c 61 73 73 2e 0a | derived| class..|
|000006f0| 0a 3e 20 41 74 20 70 72 | 65 73 65 6e 74 2c 20 49 |.> At pr|esent, I|
|00000700| 27 6d 20 74 72 79 69 6e | 67 20 74 6f 20 69 6d 70 |'m tryin|g to imp|
|00000710| 6c 65 6d 65 6e 74 20 69 | 74 20 61 73 20 61 6e 20 |lement i|t as an |
|00000720| 61 72 72 61 79 20 6f 66 | 20 70 6f 69 6e 74 65 72 |array of| pointer|
|00000730| 73 0a 3e 20 74 6f 20 66 | 75 6e 63 74 69 6f 6e 73 |s.> to f|unctions|
|00000740| 2e 20 20 54 68 6f 73 65 | 20 66 75 6e 63 74 69 6f |. Those| functio|
|00000750| 6e 73 20 77 69 6c 6c 20 | 62 65 20 63 61 6c 6c 65 |ns will |be calle|
|00000760| 64 20 62 61 73 65 64 20 | 6f 6e 20 74 68 65 0a 3e |d based |on the.>|
|00000770| 20 50 61 63 6b 65 74 20 | 74 79 70 65 2c 20 61 6e | Packet |type, an|
|00000780| 64 20 63 72 65 61 74 65 | 20 74 68 65 20 61 70 70 |d create| the app|
|00000790| 72 6f 70 72 69 61 74 65 | 20 6f 62 6a 65 63 74 2e |ropriate| object.|
|000007a0| 20 20 4f 66 20 63 6f 75 | 72 73 65 20 49 0a 3e 20 | Of cou|rse I.> |
|000007b0| 68 61 76 65 6e 27 74 20 | 65 76 65 6e 20 74 68 6f |haven't |even tho|
|000007c0| 75 67 68 74 20 61 62 6f | 75 74 20 67 6f 69 6e 67 |ught abo|ut going|
|000007d0| 20 6f 75 74 20 6f 66 20 | 73 63 6f 70 65 2c 20 64 | out of |scope, d|
|000007e0| 65 73 74 72 75 63 74 6f | 72 73 2c 0a 3e 20 6f 72 |estructo|rs,.> or|
|000007f0| 20 73 75 63 68 2e 20 20 | 4d 79 20 63 6f 77 6f 72 | such. |My cowor|
|00000800| 6b 65 72 20 73 61 79 73 | 20 74 6f 20 6a 75 73 74 |ker says| to just|
|00000810| 20 75 73 65 20 61 20 62 | 69 67 20 73 77 69 74 63 | use a b|ig switc|
|00000820| 68 20 73 74 61 74 65 6d | 65 6e 74 0a 3e 20 61 6e |h statem|ent.> an|
|00000830| 64 20 63 6f 6e 73 74 72 | 75 63 74 20 6f 62 6a 65 |d constr|uct obje|
|00000840| 63 74 73 20 62 61 73 65 | 64 20 6f 6e 20 74 68 65 |cts base|d on the|
|00000850| 20 74 79 70 65 2e 0a 0a | 49 66 20 74 68 65 20 6e | type...|If the n|
|00000860| 75 6d 62 65 72 20 6f 66 | 20 70 61 63 6b 65 74 73 |umber of| packets|
|00000870| 20 69 73 20 66 69 78 65 | 64 2c 20 79 6f 75 20 63 | is fixe|d, you c|
|00000880| 61 6e 20 73 74 69 6c 6c | 20 75 73 65 20 61 20 73 |an still| use a s|
|00000890| 77 69 74 63 68 0a 74 6f | 20 6e 65 77 20 74 68 65 |witch.to| new the|
|000008a0| 20 61 70 70 72 6f 70 72 | 69 61 74 65 20 50 61 63 | appropr|iate Pac|
|000008b0| 6b 65 74 20 74 79 70 65 | 20 61 66 74 65 72 20 72 |ket type| after r|
|000008c0| 65 61 64 69 6e 67 20 74 | 68 65 20 73 74 72 65 61 |eading t|he strea|
|000008d0| 6d 0a 0a 59 6f 75 20 6d | 61 79 20 61 6c 73 6f 20 |m..You m|ay also |
|000008e0| 62 65 20 69 6e 74 65 72 | 65 73 74 65 64 20 69 6e |be inter|ested in|
|000008f0| 20 74 68 65 20 77 6f 72 | 6b 20 6f 66 20 44 6f 75 | the wor|k of Dou|
|00000900| 67 20 53 63 68 6d 69 64 | 74 3b 20 68 65 20 68 61 |g Schmid|t; he ha|
|00000910| 73 0a 64 6f 6e 65 20 61 | 20 6c 6f 74 20 77 69 74 |s.done a| lot wit|
|00000920| 68 20 64 69 73 74 72 69 | 62 75 74 65 64 20 6e 65 |h distri|buted ne|
|00000930| 74 77 6f 72 6b 73 20 61 | 6e 64 20 43 2b 2b 2e 20 |tworks a|nd C++. |
|00000940| 20 53 65 65 0a 0a 20 20 | 20 68 74 74 70 3a 2f 2f | See.. | http://|
|00000950| 77 77 77 2e 63 73 2e 77 | 75 73 74 6c 2e 65 64 75 |www.cs.w|ustl.edu|
|00000960| 2f 7e 73 63 68 6d 69 64 | 74 2f 72 65 70 6f 72 74 |/~schmid|t/report|
|00000970| 2d 64 6f 63 2e 68 74 6d | 6c 0a 0a 43 6f 70 6c 69 |-doc.htm|l..Copli|
|00000980| 65 6e 20 74 61 6c 6b 73 | 20 61 62 6f 75 74 20 22 |en talks| about "|
|00000990| 76 69 72 74 75 61 6c 20 | 63 6f 6e 73 74 72 75 63 |virtual |construc|
|000009a0| 74 6f 72 73 22 20 69 6e | 20 68 69 73 20 0a 22 41 |tors" in| his ."A|
|000009b0| 64 76 61 6e 63 65 64 20 | 43 2b 2b 20 50 72 6f 67 |dvanced |C++ Prog|
|000009c0| 72 61 6d 6d 69 6e 67 20 | 53 74 79 6c 65 73 20 61 |ramming |Styles a|
|000009d0| 6e 64 20 49 64 69 6f 6d | 73 22 0a 0a 62 6f 77 64 |nd Idiom|s"..bowd|
|000009e0| 65 6e 0a 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |en.-----|--------|
|000009f0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000a00| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000a10| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000a20| 2d 2d 2d 2d 2d 2d 2d 0a | 47 2e 20 42 6f 77 64 65 |-------.|G. Bowde|
|00000a30| 6e 20 57 69 73 65 0a 43 | 6f 6d 70 75 74 65 72 20 |n Wise.C|omputer |
|00000a40| 53 63 69 65 6e 63 65 20 | 44 65 70 74 2c 20 52 65 |Science |Dept, Re|
|00000a50| 6e 73 73 65 6c 61 65 72 | 20 50 6f 6c 79 74 65 63 |nsselaer| Polytec|
|00000a60| 68 6e 69 63 20 49 6e 73 | 74 2c 20 54 72 6f 79 2c |hnic Ins|t, Troy,|
|00000a70| 20 4e 59 20 31 32 31 38 | 30 0a 45 6d 61 69 6c 3a | NY 1218|0.Email:|
|00000a80| 20 77 69 73 65 62 40 63 | 73 2e 72 70 69 2e 65 64 | wiseb@c|s.rpi.ed|
|00000a90| 75 20 20 20 20 20 20 20 | 20 20 57 57 57 3a 20 68 |u | WWW: h|
|00000aa0| 74 74 70 3a 2f 2f 77 77 | 77 2e 63 73 2e 72 70 69 |ttp://ww|w.cs.rpi|
|00000ab0| 2e 65 64 75 2f 7e 77 69 | 73 65 62 2f 0a |.edu/~wi|seb/. |
+--------+-------------------------+-------------------------+--------+--------+